<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 
        阻止默认动作
        超链链  <a href="javascript:;"></a>
        表单   <form action=""  onsubmit="return false">
        图像

        e.preventDefault()
     -->
    <a href="javascript:;">单击</a>
    <a href="javascript:void(0);">单击</a>
    <a href="http://www.baidu.com" class="btn">单击</a>
    <script>
        var btn = document.querySelector('.btn');
        btn.onclick = function (e) {
            console.log(e);
            e = e || window.event;
            e.preventDefault();//阻止默认动作

        }

    </script>
    <!-- <form action="./03事件流.html" onsubmit="return show()">

        <input type="submit">
        <button>提交</button>
    
    </form> -->

    <form action="./03事件流.html" id="form">

        <input type="submit">
        <button>提交</button>

    </form>

    <script>
        function show() {
            //  return true;
            return false;
        }


        var form = document.querySelector('#form');
        form.onsubmit = function (e) {
            //    return false;
            e = e || window.event;
            e.preventDefault();
        }
    </script>
</body>

</html>